package test;

import java.util.Scanner;

//计算字符个数
public class topic15 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String s1 = scanner.nextLine().toLowerCase();
            char s2 = scanner.nextLine().toLowerCase().toCharArray()[0];
            int i1 = 0;
            for (int i = 0; i < s1.length(); i++) {
                if (s2 == s1.charAt(i)){
                    i1 ++;

                }
            }
            System.out.println(i1);
        }
    }
}
